using Microsoft.Xna.Framework;

namespace Oops.Xna.Framework.Viewpoint.Cameras
{
	/// <summary>
	/// Represents a camera without movement.
	/// </summary>
	/// <remarks>
	/// Uses of the <see cref="StaticCamera"/> allows fir the <see cref="StaticCamera.View"/> field
	/// to be set manually.
	/// </remarks>
	public class StaticCamera : Camera 
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="StaticCamera"/> class.
		/// </summary>
		/// <param name="game">The associated <see cref="Microsoft.Xna.Framework.Game"/>.</param>
		/// <param name="name">The name of the <see cref="StaticCamera"/>.</param>
		public StaticCamera(Game game, string name) : base(game, name) 
		{ 
			// Default view update.
			this.IsViewUpdated = true;
		}

		/// <summary>
		/// Gets or sets whether the <see cref="Camera.View"/> is created from 
		/// <see cref="Camera.Position"/> and <see cref="Camera.Orientation"/>.
		/// </summary>
		/// <remarks>
		/// <b>true</b> if the <see cref="Camera.View"/> should be updated by <see cref="Camera.Position"/> 
		/// and <see cref="Camera.Orientation"/>. Otherwise, the <see cref="Camera.View"/> field should be
		/// set manually.
		/// </remarks>
		public bool IsViewUpdated { get; set; }

		#region Camera Members

		protected override void UpdateView()
		{
			// Check flag before updating.
			if (this.IsViewUpdated)
			{
				base.UpdateView();
			}
		}

		#endregion
	}
}
